<!--{template lyear:header_simple_start}-->
<script src="admin/scripts/admin.js?{VERHASH}"></script>
<!--{template lyear:header_simple_end}-->
<main class="bs-main-container">
	<div class="container-fluid">
		<div class="card">
			<div class="card-body">
				<ul class="nav nav-pills">
					<li class="nav-item">
						<a class="nav-link" href="{MOD_URL}&operation=smiley">{lang expression_set}</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="{MOD_URL}&op=smiley">{lang expression_class}</a>
					</li>
					<li class="nav-item">
						<a class="nav-link active" href="{MOD_URL}&operation=$operation&op=smiley&id=$id">{lang detailedness} - $smtype[name]</a>
					</li>
				</ul>
			</div>
		</div>
		<div class="card">
			<div class="card-body">
				<form id="appform" name="appform" class="form-horizontal" action="{MOD_URL}&op=smiley&operation=edit" method="post">
					<input type="hidden" name="editsubmit" value="true" />
					<input type="hidden" name="id" value="$id" />
					<input type="hidden" name="formhash" value="{FORMHASH}" />
					<div class="table-responsive">
						<table class="table table-hover align-middle">
							<thead>
								<th width="30">&nbsp;</th>
								<th>{lang sort}</th>
								<th>{lang photo}</th>
								<th>{lang expression}ID</th>
								<th>{lang expression_code}</th>
								<th>{lang expression_describing}</th>
								<th>{lang filename}</th>
							</thead>
							<!--{loop $list $key $value}-->
							<tr>
								<td align="center">
									<input type="checkbox"  class="form-check-input" name="delete[]" value="$value[id]" />
								</td>
								<td><input type="text" class="form-control" style="width:45px;" name="displayorder[{$value[id]}]" value="$value[displayorder]" style="width:20px;" /></td>
								<td><img src="$smurl/$value[url]" border="0" onload="if(this.height>30) {this.resized=true; this.height=30;}" onmouseover="if(this.resized) this.style.cursor='pointer';" onclick="if(!this.resized) {return false;} else {window.open(this.src);}"></td>
								<td>$value[id]</td>
								<td><input type="text" class="form-control" name="code[{$value[id]}]" id="code_{$key}" value="$value[code]" smileyid="$value[id]" /></td>
								<td><input type="text" class="form-control" name="title[{$value[id]}]" id="title_{$key}" value="$value[title]" /></td>
								<td>$value[url]<input type="hidden" value="$value[url]" id="url_{$key}" /></td>
							</tr>
							<!--{/loop}-->
							<tr>
								<td></td>
								<td colspan="8" style="">
									{lang batch_code_set_expression}
									<input type="text" class="form-control" style="display: inline-block;margin-right:0;width:40px;height:30px;padding:2px 4px" value="{:" title="{lang prefix}" id="prefix" onclick="clearinput(this, '{lang prefix}')"> +
									<select id="middle" class="form-control" style="display: inline-block;width:100px;height:30px;padding:2px 4px">
										<option value="1">{lang filename}</option>
										<option value="2">{lang natural_order}</option>
										<option value="3">{lang expression} ID</option>
										<option value="4">{lang expression_describing}</option>
									</select>
									+
									<input type="text" class="form-control" style="display: inline-block;margin-right:0;width:40px;height:30px;padding:2px 4px" value=":}" title="{lang suffix}" id="suffix" onclick="clearinput(this, '{lang suffix}')">
									<input type="button" class="btn btn-outline-info" onclick="addsmileycodes('{$smileynum}', '');" value="{lang type_app}"> &nbsp;&nbsp; <input type="button" class="btn btn-outline-info" onclick="autoaddsmileycodes('{$smileynum}');" value="{lang automatic_set}">
								</td>
							</tr>
							<thead>
								<th colspan="15" valign="middle" style="border:none"><label for="chkall" class="checkbox-inline"><input type="checkbox"  class="form-check-input" name="chkall" id="chkall"  onclick="checkAll('prefix', this.form, 'delete')">&nbsp;{lang del}</label>&nbsp;&nbsp;<input type="submit" class="btn btn-primary btn-round bodyloading" value="{lang submit}" /></th>
							</thead>
						</table>
					</div>
				</form>
			</div>
		</div>
  	</div>
</main>
<script type="text/JavaScript">
	function addsmileycodes(smiliesnum, pre) { 
		smiliesnum = parseInt(smiliesnum);
		if(smiliesnum > 1) { 
			for(var i = 1; i < smiliesnum; i++) {
				var prefix=trim($(pre + 'prefix').value);
				var suffix=trim($(pre + 'suffix').value);
				var page=parseInt( '$page'); 
				var middle=$(pre + 'middle').value==1 ? $(pre + 'url_' + i).value.substr(0,$(pre + 'url_' + i).value.lastIndexOf( '.')) : ($(pre + 'middle').value==2 ? i + page * 10 : ($(pre + 'middle').value==3 ? $(pre + 'code_'+ i).attributes[ 'smileyid'].nodeValue:$(pre + 'title_'+ i).value)); 
				if(!prefix || prefix=='{lang prefix}' || !suffix || suffix=='{lang suffix}' ) {
				 alert( '{lang seeting_smileyedit_prefix}'); 
				 return; 
				} 
				suffix=! suffix || suffix=='{lang suffix}' ? '' : suffix; $(pre + 'code_' + i).value=prefix + middle + suffix; 
			} 
		} 
	}
	function autoaddsmileycodes(smiliesnum) { 
	 	smiliesnum=parseInt(smiliesnum); 
	 	if(smiliesnum > 1) { 
	 		for(var i = 1; i < smiliesnum; i++) { 
	 			$( 'code_' + i).value='{:' + '$id' + '_' + $( 'code_'+ i).attributes[ 'smileyid'].nodeValue + ':}'; 
	 		} 
	 	} 
	 } 
	function clearinput(obj, defaultval) { 
		if(obj.value==defaultval) {
		 obj.value='' ; 
		} 
	} 
</script>
<!--{template lyear:footer_simple}-->